结合ROS利用Google开源的cartographer算法实时室内建图
学着踏实而务实,越努力越幸运。
当一个人有了足够的内涵和物质做后盾,人生就会变得底气十足。
若是美好,叫做精彩,若是糟糕,叫做经历。
Cartographer介绍
google开源中的介绍:
https://opensource.googleblog.com/2016/10/introducing-cartographer.html
ROS版本安装
ROS版本安装 https://google-cartographer-ros.readthedocs.io/en/latest/
里面有个编译完整版的和未编译版本:
链接: https://pan.baidu.com/s/1hWtI2ZH_CZbjNw2vHzSB1w 提取码: sv98
cartographer (亲测可行) 【要翻墙】
https://google-cartographer-ros.readthedocs.io/en/latest/
使用数据集
创客智造中的安装及修改方法:
https://www.ncnynl.com/archives/201801/2230.html
不同SLAM结果对比工具:
官方 https://google-cartographer.readthedocs.io/en/latest/evaluation.html
Cartographer ROS for TurtleBots:
https://google-cartographer-ros-for-turtlebots.readthedocs.io/en/latest/
报错
1.[错误]attempt to index global ‘SPARSE_POSE_GRAPH’ (a nil value)
[原因]SPARSE_POSE_GRAPH was renamed into POSE_GRAPH half a year ago. Please make sure you are running the latest version.
因此,我们在制作lua配置脚本时参考最新的例子
2.运行TB3的包的时候报错:
1 | [FATAL] [1478966491.756783878]: F1113 00:01:31.000000 11761 sensor_bridge.cc:98] Check failed: sensor_to_tracking->translation().norm() < 1e-5 The IMU frame must be colocated with the tracking frame. Transforming linear acceleration into the tracking frame will otherwise be imprecise. |
[原因]:IMU的话题虽然能够匹配上,但消息的坐标名字不对。
[解决方案]:打开:
1 | home/catkin_ws/src/turtlebot3/turtlebot3_slam/ |
修改46行的IMU消息header:imu_out.header.frame_id="imu_link"
;
算法运行
1 | roslaunch turtlebot3_gazebo turtlebot3_house.launch |
打开rviz 就可看到。关键点就是这里的雷达和里程计的frame对应。
节点依赖
launch文件中加载的节点和配置文件:
1 | <node name="cartographer_node" pkg="cartographer_ros" |
获取cartographer轨迹:
https://github.com/googlecartographer/cartographer_ros/issues/332
结合TB3运行
添加文件:
1 | cartographer_ws/src/cartographer_ros/cartographer_ros/ |
复制如下代码:
1 | include "map_builder.lua" |
添加launch文件:
1 | cartographer_ws/src/cartographer_ros/cartographer_ros/ |
复制如下代码:
1 | <!-- 请复制该文件到cartographer_ros/cartographer_ros/launch中使用 --> |
重新编译 catkin_make_isolated –install –use-ninja